<template>
    <div id="yoso">
      <el-form ref="form" :model="news" label-width="80px">
        <el-form-item label="名称">
          <el-input v-model="news.n_name"></el-input>
        </el-form-item>
        <el-form-item label="地址">
          <el-input v-model="news.n_path"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">立即创建</el-button>
        </el-form-item>
      </el-form>
    </div>
</template>

<script>
    export default {

        name: "HotWordAdd",
      data(){
          return{
            news:{
              n_name:'',
              n_path:''
            }
          }
      },
      methods:{
        onSubmit(){
          var formData = new URLSearchParams();
          Object.keys(this.news).forEach(key=>{
            formData.append(key,this.news[key]);

          });
          this.$axios.post('/NewServlet/add',formData)
            .then(resp=>{
              this.$router.push('/page/new')
            })

        }
      }
    }
</script>

<style scoped>

</style>
